package cn.lds.springbootmybatisplusexamplej380.service.impl.impl;

import cn.lds.springbootmybatisplusexamplej380.dto.ResponseDTO;
import cn.lds.springbootmybatisplusexamplej380.entity.Dept;
import cn.lds.springbootmybatisplusexamplej380.mapper.DeptMapper;
import cn.lds.springbootmybatisplusexamplej380.service.DeptService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.List;
@Service
public class DetpServiceImpl implements DeptService {

    @Resource
    private DeptMapper deptMapper;

    @Override
    public ResponseDTO<List<Dept>> selectDeptAll() {

        List<Dept> depts = deptMapper.selectList(null);

        if (CollectionUtils.isEmpty(depts)){

        }


        return ResponseDTO.buildSuccess(depts);
    }

    @Override
    public ResponseDTO<Dept> selectDeptAllById(Integer id) {
        Dept dept = deptMapper.selectById(id);

        if (null == dept){

        }


        return ResponseDTO.buildSuccess(dept);
    }
}
